<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="" />
<title>Sbeam后台管理端</title>
<%@ include file="../common/dev_head.jsp"%>
</head>
<body>
<script type="text/javascript">
$(document).ready(function(){
	$("#mainmenu li").removeClass("active-menu");
	$("#mainmenu>li").eq(3).addClass("active-menu");
});

//删除游戏
function deleteUser(palyid){
	if(confirm("你确定要删除当前游戏？该操作不可撤销！")){
		$.ajax({
			url:getContextPath()+"/admin/deletepalygame",
			type:"POST",
			data:{pid:palyid},
			success:function(result){
				if(result=="1"){
					alert("删除成功！");
					window.location.href=getContextPath()+"/admin/gamemanager";
				}else if(result=="3"){
					alert("删除游戏文件失败请稍后重试！");
				}else{
					alert("删除失败，请稍后重试！");
				}
			}
		});	
	}	
}




</script>



	<div id="wrapper">
		
		<%@ include file="./admin_title.jsp" %>
		<div id="page-wrapper">
			<div id="page-inner">
				<div class="row">
					<div class="col-md-12">
						<h1 class="page-header">试玩游戏列表</h1>
					</div>
				</div>
				<div class="row">
					<div class="col-lg-12">
						<div class="panel panel-default">
							<div class="panel-heading"></div>
							<div class="panel-body">
								<c:if test="${!empty game }">
									<div class="table-responsive">
									<table class="table table-striped table-bordered table-hover"
										id="dataTables-example" style="text-align:center;">
										<thead>
											<tr>
												<th>游戏id</th>
												<th>游戏名称</th>
												<th>开发者信息</th>
												<th>游戏类型</th>
												<th>游戏描述</th>
												<th>游戏图片</th>
												<th>上传日期</th>
												<th>操作</th>
											</tr>
										</thead>
										<tbody>
											<c:forEach items="${game }" var="p">
												<tr class="odd gradeX">
												<td>${p.palyId }</td>
												<td><span>${p.palyName }</span></td>
												<td><span>${p.palyDeveloper.devName }</span></td>
												<td><span>${p.palyType.typeName }</span></td>
												<td><span>${p.palyIntroduce }</span></td>
												<td><span><img style="width:50px;height：50px" src="${pageContext.request.contextPath }/images/games/${p.palyImg}" alt="${p.palyName }" class="img-responsive" /></span></td>
												<td><span><fmt:formatDate value="${p.palyDate}" pattern="yyyy-MM-dd" /></span></td>
												<td class="center">
													<div>
														<div>
															<a href="javascript:void(0)" onclick="deleteUser(${p.palyId})">
																<span class="glyphicon glyphicon-remove">&thinsp;删除</span>
															</a>
														</div>
														<br>
														<div>
															<a href="${pageContext.request.contextPath }/admin/download?filename=${p.palyFile}">
																<span class="glyphicon glyphicon-download-alt">&thinsp;下载</span>
															</a>
														</div>
													</div>
												</td>
											</tr>
											</c:forEach>
										</tbody>
									</table>
								</div>
								</c:if>
							</div>
							
						</div>
					</div>
					<!-- /. PAGE INNER  -->
				</div>
				<!-- /. PAGE WRAPPER  -->
			</div>
		</div>
		
		<!-- /. PAGE WRAPPER  -->
	</div>
	<!-- /. WRAPPER  -->

</body>
</html>